{#导入过滤器#}
{% load custom_filter %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="https://v3.bootcss.com/favicon.ico">

    <title>流水时间段查询区</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="https://v3.bootcss.com/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="https://v3.bootcss.com/examples/jumbotron/jumbotron.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="https://v3.bootcss.com/assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>


{#导航栏#}
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="{% url 'index:index' %}">Project name</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <form class="navbar-form navbar-right">
                <div class="form-group">
                    <input type="text" placeholder="Email" class="form-control">
                </div>
                <div class="form-group">
                    <input type="password" placeholder="Password" class="form-control">
                </div>
                <button type="submit" class="btn btn-success">Sign in</button>
            </form>
        </div><!--/.navbar-collapse -->
      </div>
</nav>

{#查询时的显示部分#}
<div class="container">
    <div class="page-header">
        <h1>按时间段查询流水:</h1>
    </div>
    <p class="lead">Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added with <code>padding-top: 60px;</code> on the <code>body &gt; .container</code>.</p>
    <p>Back to <a href="#">the default sticky footer</a> minus the navbar.</p>
</div>

{#查询一#}
<div class="container">
    <div class="row">
        <form action="#" method="post">
            {% csrf_token %}
            <div class="form-group col-sm-6 col-xs-6">
                <label for="exampleInputEmail">根据转移时间段查询：</label>
                <select class="form-control" id="exampleInputEmail" name="asset">
                    {% for time in all_time_list %}
                        {% if water_id == time.id %}
                            {#selected 默认选择#}
                            <option value="{{ time.id }}" selected>{{ time.pub_date }}</option>
                        {% else %}
                            <option value="{{ time.id }}">{{ time.pub_date }}</option>
                        {% endif %}
                    {% endfor %}
                </select>
            </div>

            <div class="form-group col-md-2">
                <label for="exampleInputEmail">&emsp;</label><br>
                <button type="submit" class="btn btn-default" data-dismiss="modal">查询</button>
            </div>
        </form>
    </div>
</div>
<hr>

{#3天内查询结果#}
<div style="margin: 10px auto;width: 90%;">
    <h3>3天内的查询结果：</h3>
    <table class="table table-striped table-bordered table-hover">
    <tr>
        <th>序号&emsp;</th>
        <th>物资&emsp;&emsp;</th>
        <th>地址&emsp;</th>
        <th>保管人&emsp;</th>
        <th>录入人&emsp;</th>
        <th>录入时间&emsp;</th>
        <th>录入状态&emsp;</th>
    </tr>

    {% for a in res5 %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ a.goods.name }}&emsp;</td>
            <td>{{ a.detail }}&emsp;</td>
            <td>{{ a.user }}&emsp;</td>
            <td>{{ a.ctrl_user }}&emsp;</td>
            <td>{{ a.pub_date }}&emsp;</td>
            <td>{{ a.pub_date|get_judge }}</td>
        </tr>
        {% empty %}
        <tr><td colspan="7">无此项录入</td></tr>
    {% endfor %}
    </table>
</div>
{#7天内查询结果#}
<div style="margin: 10px auto;width: 90%;">
    <h3>7天内的查询结果：</h3>
    <table class="table table-striped table-bordered table-hover">
    <tr>
        <th>序号&emsp;</th>
        <th>物资&emsp;&emsp;</th>
        <th>地址&emsp;</th>
        <th>保管人&emsp;</th>
        <th>录入人&emsp;</th>
        <th>录入时间&emsp;</th>
        <th>录入状态&emsp;</th>
    </tr>

    {% for a in res1 %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ a.goods.name }}&emsp;</td>
            <td>{{ a.detail }}&emsp;</td>
            <td>{{ a.user }}&emsp;</td>
            <td>{{ a.ctrl_user }}&emsp;</td>
            <td>{{ a.pub_date }}&emsp;</td>
            <td>{{ a.pub_date|get_judge }}</td>
        </tr>
        {% empty %}
        <tr><td colspan="7">无此项录入</td></tr>
    {% endfor %}
    </table>
</div>
{#1月内查询结果#}
<div style="margin: 10px auto;width: 90%;">
    <h3>1月内的查询结果：</h3>
    <table class="table table-striped table-bordered table-hover">
    <tr>
        <th>序号&emsp;</th>
        <th>物资&emsp;&emsp;</th>
        <th>地址&emsp;</th>
        <th>保管人&emsp;</th>
        <th>录入人&emsp;</th>
        <th>录入时间&emsp;</th>
        <th>录入状态&emsp;</th>
    </tr>

    {% for a in res2 %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ a.goods.name }}&emsp;</td>
            <td>{{ a.detail }}&emsp;</td>
            <td>{{ a.user }}&emsp;</td>
            <td>{{ a.ctrl_user }}&emsp;</td>
            <td>{{ a.pub_date }}&emsp;</td>
            <td>{{ a.pub_date|get_judge }}</td>
        </tr>
        {% empty %}
        <tr><td colspan="7">无此项录入</td></tr>
    {% endfor %}
    </table>
</div>
{#半年内查询结果#}
<div style="margin: 10px auto;width: 90%;">
    <h3>半年内的查询结果：</h3>
    <table class="table table-striped table-bordered table-hover">
    <tr>
        <th>序号&emsp;</th>
        <th>物资&emsp;&emsp;</th>
        <th>地址&emsp;</th>
        <th>保管人&emsp;</th>
        <th>录入人&emsp;</th>
        <th>录入时间&emsp;</th>
        <th>录入状态&emsp;</th>
    </tr>

    {% for a in res3 %}
        <tr>
            <td>{{ forloop.counter }}</td>
            <td>{{ a.goods.name }}&emsp;</td>
            <td>{{ a.detail }}&emsp;</td>
            <td>{{ a.user }}&emsp;</td>
            <td>{{ a.ctrl_user }}&emsp;</td>
            <td>{{ a.pub_date }}&emsp;</td>
            <td>{{ a.pub_date|get_judge }}</td>
        </tr>
        {% empty %}
        <tr><td colspan="7">无此项录入</td></tr>
    {% endfor %}
    </table>
</div>

</body>
</html>